package com.sanhuo.idms.dao;

import com.sanhuo.idms.bo.ClasRemoveBO;
import com.sanhuo.idms.entity.Clas;
import com.sanhuo.idms.vo.ClasVo;
import com.sanhuo.triild.Basic.BaseMapper;
import com.sanhuo.triild.annotation.Delete;
import com.sanhuo.triild.annotation.Mapper;
import com.sanhuo.triild.annotation.Select;

import java.util.List;


@Mapper
public interface ClasMapper extends BaseMapper<Clas> {

//    @InsertProvider(type = ClasProvider.class, method = "insert")
//    void save(Clas clas);

//    @Select("select * from clas")
//    List<Clas> findAll();

    @Select("select * from clas where clasGrade = #{grade}")
    List<Clas> findAll(String grade);

    @Select("select distinct clasGrade from clas")
    List<String> findAllGrade();

    @Select("select clasNum from clas where collegeId = #{collegeId} and clasGrade = #{clasGrade} order by clasNum")
    List<String> findClasByCollegeIdAndClasGrade(String collegeId, String clasGrade);

    @Select("select id,clasNum from clas where collegeId = #{collegeId} and clasGrade = #{clasGrade} order by clasNum")
    List<ClasVo> findClas(String collegeId, String clasGrade);

    @Select("select count(*) from clas where collegeId = #{collegeId}")
    Integer countByCollegeId(String collegeId);

    @Delete("delete from clas where id = #{id}")
    void remove(String id);

    @Select("select * from clas where collegeId = #{collegeId} and clasGrade = #{clasGrade}  and clasNum =#{clasNum}")
    Clas findByCollegeAndClasGradeAndClasNuM(ClasRemoveBO bo);

    @Select("select * from clas where collegeId = #{collegeId} and clasGrade = #{clasGrade}  and clasNum =#{clasNum}")
    Clas findBynum(String collegeId, String clasGrade, String clasNum);
}
